<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>预约页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center; /* 居中对齐 */
            align-items: center;
            height: 100vh; /* 填充整个屏幕 */
            background-color: #f9f9f9;
            margin: 0;
        }

        .container {
            width: 100%;
            max-width: 393px; /* 设置最大宽度为393px */
            height: 853px; /* 设置页面高度为853px */
            background-color: #fff;
            border-radius: 20px; /* 圆角效果 */
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 阴影效果 */
            padding: 20px;
            box-sizing: border-box;
            overflow: auto;
            position: relative;
        }

        h1 {
            text-align: center;
            font-size: 20px;
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            font-weight: bold;
            font-size: 14px;
        }

        .form-group select, .form-group input {
            width: 100%;
            padding: 10px;
            font-size: 14px;
            margin-top: 5px;
        }

        .messages {
            margin-bottom: 20px;
        }

        .messages label {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            font-size: 14px;
        }

        .messages input {
            margin-right: 10px;
        }

        button {
            width: 100%;
            padding: 12px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 20px;
        }

        button:hover {
            background-color: #0056b3;
        }

        .message-details {
            font-size: 12px; /* Smaller text for details */
            color: #555;
            margin-left: 10px;
        }

        /* 返回按钮样式 */
        .back-button {
            font-size: 16px;
            color: #fff;
            background-color: #808080; /* 灰色背景 */
            border: none;
            border-radius: 5px; /* 矩形按钮 */
            width: 80px; /* 按钮宽度 */
            height: 40px; /* 按钮高度 */
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            margin-bottom: 20px; /* 上下留空间 */
        }

        .back-button:hover {
            background-color: #666666; /* 悬停时灰色变暗 */
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 返回按钮 -->
        <button class="back-button" onclick="window.location.href='{{ url_for('tickets') }}'">返回</button>
        
        <h1>{{ spot.name }}</h1>
        <form method="POST">
            <div class="form-group">
                <label for="date">选择日期:</label>
                <select name="date" id="date" required>
                    {% for date in available_dates %}
                    <option value="{{ date }}">{{ date }}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="form-group">
                <label for="time">选择时间段:</label>
                <select name="time" id="time" required>
                    {% for slot in time_slots %}
                    <option value="{{ slot }}">{{ slot }}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="messages">
                <label>选择旅客信息:</label>
                {% for message in messages %}
                <label>
                    <input type="checkbox" name="messages" value="{{ message.id }}"> {{ message.name }} 
                    <span class="message-details">身份证: {{ message.idcard }} | 票类型: {{ message.type }}</span>
                </label>
                {% endfor %}
            </div>
            <button type="submit">提交预约</button>
        </form>
    </div>
</body>
</html>
